package com.mf.ergate.api.auth;

import com.mf.ergate.api.ApiConfig;
import com.mf.ergate.api.auth.model.dto.RoleResourceRelationCreateDto;
import com.mf.ergate.api.auth.model.dto.RoleResourceRelationDeleteDto;
import com.mf.ergate.api.auth.model.dto.RoleResourceRelationQueryDto;
import com.mf.ergate.api.auth.model.dto.RoleResourceRelationUpdateDto;
import com.mf.ergate.api.auth.model.vo.RoleResourceRelationVo;
import com.mf.framework.common.model.Page;
import com.mf.framework.common.model.RemotePage;
import com.mf.framework.common.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * 角色与资源关联RemoteService层接口类
 * User: zhaoming
 * DateTime: 2019-02-08
 * To change this template use File | Settings | File Templates.
 **/
@Api(value = "/api/roleResourceRelation", tags = "RoleResourceRelationController", description = "角色与资源关联服务")
@FeignClient(name= ApiConfig.SERVICE_NAME)
@RequestMapping("/api/roleResourceRelation")
public interface RoleResourceRelationRemoteService{

    /**
     * 新增
     * @param roleResourceRelationCreateDto 角色与资源关联新增Dto
     * @return 角色与资源关联
     */
    @ApiOperation(value = "新增")
    @ApiImplicitParam(name = "roleResourceRelationCreateDto", value = "角色与资源关联新增Dto", dataType = "RoleResourceRelationCreateDto",  required = true, paramType = "body")
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    Result<RoleResourceRelationVo> insert(@RequestBody RoleResourceRelationCreateDto roleResourceRelationCreateDto);

    /**
     * 根据唯一编号更新
     * @param roleResourceRelationUpdateDto 角色与资源关联更新Dto
     * @return 执行结果
     */
    @ApiOperation(value = "根据唯一编号更新")
    @ApiImplicitParam(name = "roleResourceRelationUpdateDto", value = "角色与资源关联更新Dto", dataType = "RoleResourceRelationUpdateDto",  required = true, paramType = "body")
    @RequestMapping(value = "/updateByUniqueNo", method = RequestMethod.POST)
    Result<Boolean> updateByUniqueNo(@RequestBody RoleResourceRelationUpdateDto roleResourceRelationUpdateDto);

    /**
     * 根据唯一编号删除(逻辑删除)
     * @param roleResourceRelationDeleteDto 角色与资源关联删除Dto
     * @return 执行结果
     */
    @ApiOperation(value = "根据唯一编号删除(逻辑删除)")
    @ApiImplicitParam(name = "roleResourceRelationDeleteDto", value = "角色与资源关联删除Dto", dataType = "RoleResourceRelationDeleteDto",  required = true, paramType = "body")
    @RequestMapping(value = "/deleteByUniqueNo", method = RequestMethod.POST)
    Result<Boolean> deleteByUniqueNo(@RequestBody RoleResourceRelationDeleteDto roleResourceRelationDeleteDto);

    /**
     * 根据唯一编号查询
     * @param uniqueNo 唯一编号
     * @return 角色与资源关联
     */
    @ApiOperation(value = "根据唯一编号查询")
    @ApiImplicitParam(name = "uniqueNo", value = "唯一编号", dataType = "String",  required = true, paramType = "body")
    @RequestMapping(value = "/selectByUniqueNo", method = RequestMethod.POST)
    Result<RoleResourceRelationVo> selectByUniqueNo(@RequestBody String uniqueNo);

    /**
     * 根据条件查询
     * @param roleResourceRelationQueryDto 角色与资源关联查询Dto
     * @return 角色与资源关联列表
     */
    @ApiOperation(value = "根据条件查询")
    @ApiImplicitParam(name = "roleResourceRelationQueryDto", value = "角色与资源关联查询Dto", dataType = "RoleResourceRelationQueryDto",  required = true, paramType = "body")
    @RequestMapping(value = "/selectByCondition", method = RequestMethod.POST)
    Result<List<RoleResourceRelationVo>> selectByCondition(@RequestBody RoleResourceRelationQueryDto roleResourceRelationQueryDto);

    /**
     * 根据条件查询数量
     * @param roleResourceRelationQueryDto 角色与资源关联查询Dto
     * @return 数量
     */
    @ApiOperation(value = "根据条件查询数量")
    @ApiImplicitParam(name = "roleResourceRelationQueryDto", value = "角色与资源关联查询Dto", dataType = "RoleResourceRelationQueryDto",  required = true, paramType = "body")
    @RequestMapping(value = "/selectCount", method = {RequestMethod.POST})
    Result<Integer> selectCount(@RequestBody RoleResourceRelationQueryDto roleResourceRelationQueryDto);

    /**
     * 根据条件分页查询
     * @param remotePage 远程分页
     * @return 角色与资源关联分页列表
     */
    @ApiOperation(value = "根据条件分页查询")
    @ApiImplicitParam(name = "remotePage", value = "远程分页", dataType = "RemotePage",  required = true, paramType = "body")
    @RequestMapping(value = "/selectPage", method = {RequestMethod.POST})
    Result<Page<RoleResourceRelationVo>> selectPage(@RequestBody RemotePage<RoleResourceRelationQueryDto> remotePage);

    /**
     * 保存角色与菜单关联关系
     * @param roleResourceRelationCreateDtos 角色与资源关联新增Dto列表
     */
    @ApiOperation(value = "保存角色与菜单关联关系")
    @ApiImplicitParam(name = "roleResourceRelationCreateDtos", value = "角色与资源关联新增Dto列表", dataType = "List",  required = true, paramType = "body")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    Result<Boolean> save(@RequestBody List<RoleResourceRelationCreateDto> roleResourceRelationCreateDtos);
}
